package com.icinfo.cloud.provider.common.oss.controller;

import com.icinfo.cloud.provider.common.dto.FileInfoSaveDto;
import com.icinfo.cloud.provider.common.oss.service.IOssOperateService;
import com.icinfo.framework.common.web.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


/**
 * 描述：oss操作前端控制器
 *
 * @author xiangyuyu
 * @date 2022/3/12 11:44
 */
@RestController
@RequestMapping("/common/oss")
@Slf4j
public class OssOperateController {
    @Resource
    private IOssOperateService iOssOperateService;


    /**
     * 描述：上传文件
     *
     * @param fileInfo {@link FileInfoSaveDto} 文件信息
     * @return {@link Result<String>} 上传成功的文件oss地址
     * @author xiangyuyu
     * @date 2022-03-12 11:54
     */
    //@PostMapping("/uploadFile")
    public Result<String> uploadFile(@RequestBody @Validated FileInfoSaveDto fileInfo) {
        return iOssOperateService.uploadFile(fileInfo);
    }
}
